home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_146 / dmemacros / commentedmacros / c.function.edrc next >
Text File  |  1992-05-06  |  2KB  |  46 lines

  1. # insert lines for body of text; write marker in text to save location;
  2. # move cursor up one line (may have to add a line if at the top) and move
  3. # to the first character in the line (if there are no characters in the
  4. # line, the cursor moves to the leftmost column;
  5.  
  6. repeat 5 insline `+'  ifelse t insline up  firstnb
  7.  
  8.  
  9. # if there is text on this line, insert two lines between this line and the
  10. # first line of the template; otherwise, go up one more line and check for
  11. # text; if it's there insert one line between that line and the template;
  12. # you are now guaranteed that at least two blank lines are between the tem-
  13. # plate and any text above it;
  14.  
  15. ifelse c>32  `down repeat 2 `insline down''  `ifelse t insline up firstnb if c>32 `down insline' down down'
  16.  
  17.  
  18. # go down to end of template and insure that there are at least two lines
  19. # between it and any text below it;
  20.  
  21.  repeat 5 down firstnb
  22.  
  23. ifelse c>32  `insline insline'  `if b insline down firstnb if c>32 insline up'
  24.  
  25.  
  26. # move back to marker and delete it;
  27. repeat 5 up   firstnb del
  28.  
  29.  
  30. # write the body of the template; write a marker for later search & replace
  31. # needed to complete comment with function name; place cursor in position to
  32. # write between parentheses in test expression;
  33.  
  34. ` ()'           firstnb left down down
  35. `{'             firstnb down down
  36. `} /* + () */'  findstr ` (' up prev
  37.  
  38.  
  39. # prompt for the name of the function (it will printed as a string at the
  40. # cursor location; goto first character of name and read the function name
  41. # into the variable $scanf; replace the marker in the comment with the name
  42. # in $scanf (function name); move to blank line between braces and indent
  43. # for entry of next line of code;
  44.  
  45. escimm (`)    firstnb    scanf %s down    findr `+' $scanf    firstnb up tab
  46.